let baseUrl = 'https://api.whdxx.com/'
baseUrl = 'http://81.68.69.48:9011/'
baseUrl = 'http://localhost:9011/'
baseUrl = 'https://jiah-tech.com/'
const request = (url = '', data={},type='POST',header={})=>{
	let userInfo = uni.getStorageSync("userInfo")
	if(userInfo) {
		data.operator = userInfo.name
		data.merId = userInfo.merId
		data.shopId = userInfo.shopId
		data.customerId = userInfo.id
	}
	return new Promise((resolve, reject) => {
		uni.request({
			method: type,
			url: baseUrl + url,
			data: data,
		}).then(response => {
			let [error,res] = response
			resolve(res.data)
		}).catch(error => {
			let [err,res] = error
			reject(err)
		})
	}).then(res => {
		if(res.code == 0 || res.code == 200) {
			return res
		}
	})
}
export default request
